package my.design.factory.prize;

import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;

/**
 * @author zp
 * @version 1.0
 * @description: TODO
 * @date 2022/9/30 19:43
 */
public class CardCommodityService implements ICommodity {
    private Logger logger = LoggerFactory.getLogger(CardCommodityService.class);
    // 模拟注⼊入
    private IQiYiCardService iQiYiCardService = new IQiYiCardService();

    public void sendCommodity(String uId, String commodityId, String
            bizId, Map<String, String> extMap) throws Exception {
        String mobile = queryUserMobile(uId);
        iQiYiCardService.grantToken(mobile, bizId);
        logger.info("请求参数[爱奇艺兑换卡] => uId： {} commodityId： {} bizId： {} extMap： {}", uId, commodityId, bizId, JSONObject.toJSONString(extMap));
        logger.info("测试结果[爱奇艺兑换卡]： success");
    }

    private String queryUserMobile(String uId) {
        return "15200101232";
    }
}
